import request from '@/utils/request'

// 蓝云ai
export function chatmessage(question) {
  const data = {
    "model_config": {
        "annotation_reply": {
            "enabled": false
        },
        "file_upload": {
            "image": {
                "detail": "high",
                "enabled": true,
                "number_limits": 3,
                "transfer": "all",
                "transfer_methods": [
                    "remote_url",
                    "local_file"
                ]
            }
        },
        "index_enhance_config": {
            "enabled": false
        },
        "model": {
            "completion_params": {
                "frequency_penalty": 0,
                "max_tokens": 4096,
                "presence_penalty": 0,
                "stop": [],
                "temperature": 0.2,
                "top_p": 0.75
            },
            "is_system": true,
            "mode": "chat",
            "name": "us-east-gpt4o",
            "provider": "azure_openai",
            "vision": true
        },
        "more_like_this": {
            "enabled": false
        },
        "opening_statement": "",
        "retriever_resource": {
            "enabled": false
        },
        "sensitive_word_avoidance": {
            "enabled": false
        },
        "speech_to_text": {
            "enabled": false
        },
        "suggested_questions": [],
        "suggested_questions_after_answer": {
            "enabled": false
        },
        "system_parameters": {
            "image_file_size_limit": "10"
        },
        "text_to_speech": {
            "enabled": false,
            "language": "",
            "pace": "10%",
            "streaming": true,
            "voice": ""
        },
        "url_format": {
            "enabled": false
        },
        "user_input_form": [],
        "userAppConfig": {
            "multiple_rounds_of_dialogue": false,
            "public_domain_dataset": false,
            "personal_domain_dataset": false,
            "index_enhance": false
        }
    },
    "response_mode": "streaming",
    "inputs": {},
    "query": question,
    "conversation_id": "706beaaf-2802-4422-89b7-c2e6255f5042",
    "files": [],
    "custom_files": [],
    "file_read_info": null,
    "open_internet": false
}
  return request({
    url: 'ai-verify.bluecloudatlas.cn/gateway/hcmsp-ai-keystone/api/chat-messages',
    headers: {
      isToken: false,
      'Content-Type': 'application/json',
      Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxZjc4ODkxMi1jY2Y5LTQ4MWQtYmM1Yi1mYmIyNzRkYzkxYmQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiMWY3ODg5MTItY2NmOS00ODFkLWJjNWItZmJiMjc0ZGM5MWJkIiwiYXBwX2NvZGUiOiJpNWxGTHV6Q0J0TVZrTFhGIiwiZW5kX3VzZXJfaWQiOjE0MCwicGhvbmUiOiIxNTk4MjczNjQ3MiIsImludGVybmFsIjp0cnVlfQ.TYXDVneeYF3sPu2cmZshsf6wXiMK4FvMis-M0VwxjrQ'
    },
    method: 'post',
    data: data
  })
}

// 获得ai的结果方法
export function getInfo(conventionId) {
  return request({
    url: 'ai-verify.bluecloudatlas.cn/gateway/hcmsp-ai-keystone/api/messages?conversation_id=706beaaf-2802-4422-89b7-c2e6255f5042',
    method: 'get'
  })
}
